home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1994
/
MacHack 1994.toast
/
MacHack™94
/
Talks & Papers
/
Timothy Knox
/
yerk 3.66
/
Supplement
/
Unsupported
/
Optionals
/
3dArray
< prev
next >
Wrap
Text File
|
1994-06-24
|
1KB
|
62 lines
\ 3 Dimensional Array
\ 1/07/85 cdn Logical extension to 2dArray
:CLASS 3dArray <Super 2dArray 4 <Indexed
Int xbnd
\ ( xbnd -- ) Store x bound; y & z bound already used by super 2dArray
:M CLASSINIT: classinit: super put: xbnd ;M
\ ( -- ) Allocate arrays for third dimension
:M NEW:
new: super
ylimit: super 0
DO
xlimit: super 0
DO
get: xbnd heap> array i j to: super
LOOP
LOOP
;M
\ ( val x y z -- )
:M TO: to: [ at: super ] ;M
\ ( x y z -- )
:M AT: at: [ at: super ] ;M
\ ( -- ) Deallocate array space in heap
:M DISPOSE:
ylimit: super 0
DO
xlimit: super 0
DO
i j at: super killptr
LOOP
LOOP
dispose: super
;M
:M XLIMIT: get: xbnd ;M
:M YLIMIT: xlimit: super ;M
:M ZLIMIT: ylimit: super ;M
:M PRINT: { \ k -- }
zlimit: self 0
DO CR ." layer:" i . CR
i -> k
ylimit: self 0
DO CR
xlimit: self 0
DO
i j k at: self .
LOOP
LOOP
LOOP
;M
;CLASS